
//    var createNonceStr = createNonceStr();
//    var timestamp =createTimestamp();
//    var signature = sign();
// var ticket = 'sM4AOVdWfPE4DxkXGEs8VOR1KrpQxg2YVF8S8Ef0ig8OnBYk6_EUv9px-ix5M6ikG2uetJmxpek4LC40SKOTuQ';//后台获取
var access_token = '';
var ticket = '';//后台获取

var getAccessToken =function () {

    $.ajax({
        url: "http://passport.api.lanaoboxiang.com/access_token",
        type: "get",
        dataType: "json",
        data: {},
        success: function (res) {
            if(res.code==0){
                access_token  = res.data.access_token;
            }else{
                alert("错误");
            }
        },
        error: function () {
            alert("错误");
        }
    });
}

var getTicket =function () {
    if(access_token == '' ){
        access_token = getAccessToken();
    }
    $.ajax({
        url: "http://passport.api.lanaoboxiang.com/ticket?access_token="+access_token,
        type: "get",
        dataType: "json",
        data: {},
        success: function (res) {
            if(res.code==0){
                ticket  = res.data.ticket;
            }else{
                alert("错误");
            }

        },
        error: function () {
            alert("错误");
        }
    });

}

if (ticket == ''){
    ticket = getTicket(access_token);
}
var url=window.location.href;

//    console.debug(sign(ticket,url));
var config=sign(ticket,url);



